package com.digtime.adapter.impl;

import com.digtime.adapter.MediaAdapter;
import com.digtime.adapter.MediaPlayer;

/**
 * @author: kaiyi
 * @Date 2020/11/22 16:02
 */
public class AudioPlayer implements MediaPlayer {
    MediaAdapter mediaAdapter;

    @Override
    public void play(String audioType, String fileName) {
        if(audioType.equalsIgnoreCase("mp3")){
            System.out.println("Playing mp3 file");
        } else if(audioType.equalsIgnoreCase("vlc")
                || audioType.equalsIgnoreCase("mp4")){
            mediaAdapter = new MediaAdapter(audioType);
            mediaAdapter.play(audioType, fileName);
        } else {
            System.out.println("Invalid media. "+ audioType + " format not supported");
        }
    }
}
